<?php
require_once('Extension/View/Helper/Abstract.php');

require_once('resources/js/externals/fckeditor/fckeditor.php');

class Extension_View_Helper_FCK extends Extension_View_Helper_Abstract
{
    public function __construct()
    {}

    public function FCK($name, $value = '', $width = '640', $height = '320', $skin = 'silver', $toolBarSet = false)
    {
        $basePath = '/resources/js/externals/fckeditor/';
        $fckEditor = new FCKeditor($name);

        $fckEditor->Config['SkinPath'] = $basePath . "editor/skins/$skin/";
        $fckEditor->Config['AutoDetectLanguage'] = false;
        $fckEditor->Config['DefaultLanguage'] = Kbs::initLocale()->getLanguage();

        if (!$toolBarSet) {
            $fckEditor->ToolbarSet = $toolBarSet;
        }

        $fckEditor->Width = $width;
        $fckEditor->Height = $height;
        $fckEditor->BasePath = $basePath;
        $fckEditor->Value = $value;

        return $fckEditor->CreateHtml();
    }
}